#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <iostream>


MainWindow::MainWindow(QWidget *parent, glFullScreenWindow* fsDisplay) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QObject::connect(ui->widgetVideoScreen, SIGNAL(setSlider(int)), ui->sldVidTime, SLOT(setVal(int)), Qt::QueuedConnection);
    QObject::connect(ui->sldVolume, SIGNAL(sliderMoved(int)), ui->widgetVideoScreen, SLOT(setVolume(int)), Qt::QueuedConnection);
    QObject::connect(ui->sldVidTime, SIGNAL(seekSignal(int)), ui->widgetVideoScreen, SLOT(seek(int)), Qt::QueuedConnection);
    fsDisplay->hide();
    ui->widgetVideoScreen->setFSWindow(fsDisplay);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_btnBrowse_clicked() {
    QString loc = QFileDialog::getOpenFileName(this, tr("Select Video File"), QDir::currentPath(), tr("Videos (*.avi *.mkv *.mp4)"));
    if (!loc.isNull())
        ui->txtFileLoc->setText(loc);
}
void MainWindow::on_btnPlay_clicked() {
    ui->widgetVideoScreen->play(ui->txtFileLoc->text());
}
void MainWindow::on_btnStop_clicked() {
    ui->widgetVideoScreen->stop();
}
void MainWindow::on_btnPause_clicked() {
    ui->widgetVideoScreen->pause();
}
